package com.cait.dutyfree.pojo;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class ProductAirlinePk implements Serializable {
	private Product product;
	private Airline airline;

	@ManyToOne
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@ManyToOne
	public Airline getAirline() {
		return airline;
	}

	public void setAirline(Airline airline) {
		this.airline = airline;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null || getClass() != obj.getClass())
			return false;

		ProductAirlinePk that = (ProductAirlinePk) obj;

		if (product != null ? !product.equals(that.product)
				: that.product != null)
			return false;
		if (airline != null ? !airline.equals(that.airline)
				: that.airline != null)
			return false;
		return true;
	}

	@Override
	public int hashCode() {
		int result;
		result = (product != null ? product.hashCode() : 0);
		result = 31 * result + (airline != null ? airline.hashCode() : 0);
		return result;
	}

}
